<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*" pageEncoding="UTF-8"%>
<%@ page import="myservlet.OnlineCounter" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
  <meta charset="UTF-8">

  <meta name="description" content="">
  <meta name="keywords" content="">

  <title>游戏商城</title>
  <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
  <link href="css/style.css" media="screen" rel="stylesheet" type="text/css">
  <link href="css/grid.css" media="screen" rel="stylesheet" type="text/css">

  <script src="js/jquery-1.7.2.min.js" ></script>
  <script src="js/html5.js" ></script>
  <script src="js/jflow.plus.js" ></script>
  <script src="js/jquery.carouFredSel-5.2.2-packed.js"></script>

  <script>
	$(document).ready(function(){
	    $("#myController").jFlow({
			controller: ".control", // must be class, use . sign
			slideWrapper : "#jFlowSlider", // must be id, use # sign
			slides: "#slider",  // the div where all your sliding divs are nested in
			selectedWrapper: "jFlowSelected",  // just pure text, no sign
			width: "984px",  // this is the width for the content-slider
			height: "480px",  // this is the height for the content-slider
			duration: 400,  // time in miliseconds to transition one slide
			prev: ".slidprev", // must be class, use . sign
			next: ".slidnext", // must be class, use . sign
			auto: true
    });
  });
  </script>
  <script>
	$(function() {
	  $('#list_product').carouFredSel({
		prev: '#prev_c1',
		next: '#next_c1',
		auto: false
	  });
          $('#list_product2').carouFredSel({
		prev: '#prev_c2',
		next: '#next_c2',
		auto: false
	  });
	  $(window).resize();
	});
  </script>
  <script>
       $(document).ready(function(){
	      $("button").click(function(){
		     $(this).addClass('click')
	      });
       })
  </script>

</head>
<!-- 数据库连接 -->
<%
	ProductDao pt = new ProductDao();
	List P2 = pt.findProductBYBest();
	List Pl = pt.findProduct();
	TypeDao pt1 = new TypeDao();
	List pl2 = pt1.findmain_type();
	%>
	<!-- 数据库连接 -->
<body>
  <div class="container_12">
    <div id="top">
      <div class="grid_3">
        <div class="phone_top">
          Call CN +110    
        </div><!-- .phone_top -->
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <div class="welcome">
   <% if(session.getAttribute("userSession")!=null){%>
        上次登录的时间:<%=session.getAttribute("lasttime") %>
   &nbsp;&nbsp;&nbsp;当前在线人数:<%=OnlineCounter.getOnline()%>
         <%}  %>
        </div><!-- .welcome -->
      </div><!-- .grid_6 -->

      <div class="grid_3">
        
      </div><!-- .grid_3 -->
    </div><!-- #top -->

    <div class="clear"></div>

    <header id="branding">
      <div class="grid_3">
        <hgroup>
          <h1 id="site_logo" ><a href="index.jsp" title=""><img  height="119.8" width="130.8" src="images/login.jpg" alt="Online Store Theme Logo"/></a></h1>
          <h2 id="site_description">年轻人的第一个游戏网</h2>
        </hgroup>
      </div><!-- .grid_3 -->

      <div class="grid_3">
        <form class="search" action="catalog_search.jsp" method="post">
          <input type="text" name="search" class="entry_form" value="" placeholder="寻找游戏"/>
	    </form>
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <ul id="cart_nav">
          <li>
            <a class="cart_li" href="shop_cart.jsp"><span>购物车</span></a>
          </li>
        </ul>

        <nav class="private">
          <ul>
       <% if(session.getAttribute("userSession")==null){%> 
            <li><a href="login.jsp">登录</a></li>
            <li class="separator">|</li>
            <li><a href="Create user.jsp">注册</a></li>
        <%}else{  %>
       <li><a href="##.jsp">用户(<%=session.getAttribute("username") %>)身份(<%=session.getAttribute("userSession")%>)</a>
        <li class="separator">|</li>
       <% if(session.getAttribute("userSession").equals("管理员") ){ %><li><a href="admin/ht.jsp"><span>后台</span></a></li><% } %>
       <% if(session.getAttribute("userSession").equals("客户") ){ %><li><a href="Personal.jsp"><span>个人信息</span></a></li><% } %>
       <li class="separator">|</li>
       <li> <a href="deal/logout.jsp" >[注销]</a></li>
			    <%}  %>
			    
			    <li><a href="app/Shop.apk" >Android APP下载</a></li>

          </ul>
        </nav><!-- .private -->
      </div><!-- .grid_6 -->
    </header><!-- #branding -->
  </div><!-- .container_12 -->

  <div class="clear"></div>

  <div id="block_nav_primary">
    <div class="container_12">
      <div class="grid_12">
        <nav class="primary">
          <ul>
            <li class="curent"><a href="index.jsp">首页</a></li>
            <li><a href="blog_post.jsp">新闻</a></li>
            <li><a href="catalog_grid.jsp">类型</a></li>
<%
	if (pl2.size() > 0) {
		for (int i = 0; i < pl2.size(); i++) {
			main_type pd2 = (main_type) pl2.get(i);			
%>
                <li><span><a href="catalog_grid.jsp?type=<%=pd2.getT_id()%>"><%=pd2.getT_type() %></a></span></li>
				<%}
				}else{ %>
                <li><span><a href="#">没有产品区</a></span></li>
				<%} %>		
          </ul>
        </nav><!-- .primary -->
      </div><!-- .grid_12 -->
    </div><!-- .container_12 -->
  </div><!-- .block_nav_primary -->

  <div class="clear"></div>

  <div class="container_12">
    <div class="grid_12">
        <div class="slidprev"><span>Prev</span></div>
        <div class="slidnext"><span>Next</span></div>
        <div id="slider">
          <div id="slide1">
            <a  href="showProductMessage.jsp?p_id=ip10006"><img src="images/ht5.png" alt="" title="" /></a>
            
          </div>

          <div id="slide2">
            <a href="showProductMessage.jsp?p_id=dh0025"><img src="images/fs4.png" alt="" title="" /></a>
          </div>

          <div id="slide3">
            <a href="showProductMessage.jsp?p_id=bu10006"><img src="images/ac.png" alt="" title="" /></a>
            
          </div>
        </div><!-- .slider -->
        <div id="myController">
          <div class="control"><span>1</span></div>
          <div class="control"><span>2</span></div>
          <div class="control"><span>3</span></div>
        </div>


    </div><!-- .grid_12 -->
  </div><!-- .container_12 -->

  <div class="clear"></div>

  <section id="main" class="home">
    <div class="container_12">
      <div id="top_button">


        <div class="clear"></div>
      </div><!-- #top_button -->

      <div class="clear"></div>

      <div class="carousel">
        <div class="c_header">
          <div class="grid_10">
            <h2>热销产品</h2>
          </div><!-- .grid_10 -->

          <div class="grid_2">
            <a id="next_c1" class="next arows" href="#"><span>Next</span></a>
            <a id="prev_c1" class="prev arows" href="#"><span>Prev</span></a>
           </div><!-- .grid_2 -->
        </div><!-- .c_header -->

        <div class="list_carousel">

        <ul id="list_product" class="list_product">
<%
	if (P2.size() > 0) {
		for (int i = 0; i < P2.size(); i++) {
			Product pd2 = (Product) P2.get(i);
%>
          <li class="">
            <div class="grid_3 product">
              <img class="sale" src="images/sale.png" alt="Sale"/>
              <div class="prev">
                <a href="showProductMessage.jsp?p_id=<%=pd2.getP_id()%>"><img src="<%=pd2.getP_image() %>"  alt="热销商品1" title="热销商品1"></a>
              </div><!-- .prev -->
              <h3 class="title"><%=pd2.getP_name() %></h3>
              <div class="cart">
                <div class="price">
                <div class="vert">
                  <div class="price_new">售价：￥<%=pd2.getP_price() %></div>
                </div>
                </div>
                <a href="#" class="obn"></a>
                <a href="#" class="like"></a>
                <a href="deal/cart_add.jsp?p_id=<%=pd2.getP_id() %>" class="bay"></a>
              </div><!-- .cart -->
            </div><!-- .grid_3 -->
          </li>
<%}
				}else{ %>
				<tr>
            <td height="26" colspan="2"> <a href="#" class="dong06">暂无</a></td>
          </tr>
          <tr>
            <td colspan="2"><img src="image/d03.jpg" width="352" height="1" /></td>
          </tr>
<%} %>



        </ul><!-- #list_product -->
        </div><!-- .list_carousel -->
      </div><!-- .carousel -->

      <div class="carousel">
        <div class="c_header">
          <div class="grid_10">
            <h2>新上架产品</h2>
          </div><!-- .grid_10 -->

          <div class="grid_2">
            <a id="next_c2" class="next arows" href="#"><span>Next</span></a>
            <a id="prev_c2" class="prev arows" href="#"><span>Prev</span></a>
          </div><!-- .grid_2 -->
        </div><!-- .c_header -->

        <div class="list_carousel">
        <ul id="list_product2" class="list_product">
 <%
	if (Pl.size() > 0) {
		for (int i = 0; i < Pl.size(); i++) {
			Product pd = (Product) Pl.get(i);
%>       
          <li class="">
            <div class="grid_3 product">
              <img class="sale" src="images/sale.png" alt="Sale"/>
                <div class="prev"> 
                <a href="showProductMessage.jsp?p_id=<%=pd.getP_id()%>"><img  src="<%=pd.getP_image() %>" alt="热销商品1" title="热销商品1"></a> 
              </div><!-- .prev -->
              <h3 class="title"><%=pd.getP_name() %></h3>
              <div class="cart">
                <div class="price">
                <div class="vert">
                  <div class="price_new">售价：￥<%=pd.getP_price() %></div>
                </div>
                </div>
                <a href="#" class="obn"></a>
                <a href="#" class="like"></a>
                <a href="deal/cart_add.jsp?p_id=<%=pd.getP_id() %>" class="bay"></a>
              </div><!-- .cart -->
            </div><!-- .grid_3 -->
          </li>
				<%}
				}else{ %>
				<tr>
            <td height="26" colspan="2"> <a href="#" class="dong06">暂无</a></td>
          </tr>
          <tr>
            <td colspan="2"><img src="image/d03.jpg" width="352" height="1" /></td>
          </tr>
				<%} %>
        </ul><!-- #list_product2 -->
        </div><!-- .list_carousel -->
      </div><!-- .carousel -->



  <footer>
 <div class="f_info">
      <div class="container_12">
        <div class="grid_6">
          <p class="copyright">BY 417工作室, 2015</p>
        </div><!-- .grid_6 -->

        <div class="grid_6">
          <div class="soc">
          
          </div><!-- .soc -->
        </div><!-- .grid_6 -->

        <div class="clear"></div>
      </div><!-- .container_12 -->
    </div><!-- .f_info -->
  </footer>

</body>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
</html>
